package com.raven.craft.code.generator.project.testcase.vo;

import lombok.*;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

@Getter
@Setter
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class ArgConstraint {
    private String name; // 参数名称
    private List<Object> values; // 参数值枚举
    private Integer valuesCount; // 如果不想枚举 values, 设置 valuesCount, 可以自动枚举

    public List<Object> getValues() {
        if (values == null || values.isEmpty()) {
            if (valuesCount == null) {
                throw new IllegalArgumentException("values or valuesCount cannot be null");
            } else {
                values = IntStream.range(1, valuesCount).boxed().collect(Collectors.toList());
            }
        }
        return values;
    }

}
